package com.kiss.rpc.channelhandler;

import com.kiss.rpc.channelhandler.handler.MySimpleChannelInboundHandler;
import com.kiss.rpc.channelhandler.handler.RpcRequestEncoder;
import com.kiss.rpc.channelhandler.handler.RpcResponseDecoder;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;

public class ConsumerChannelInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel socketChannel) {
        socketChannel.pipeline()
                .addLast(new LoggingHandler(LogLevel.WARN))
                .addLast(new RpcRequestEncoder())
                .addLast(new RpcResponseDecoder())
                .addLast(new MySimpleChannelInboundHandler());
    }
}
